package com.motu.monstercity.server.game.logic;

import com.motu.monstercity.server.game.userdata.*;
import com.motu.vertx.module.utility.model.EntityManager;
import com.motu.vertx.module.utility.model.Model;

import java.util.ArrayList;
import java.util.List;

public class UnionMobileUserData extends UnionMobileBaseData{

    // 获取联盟公共任务列表
    public static UnionMobileTaskInfo getUnionMobileTaskInfo(long unionId, long taskId) {
        Model model = EntityManager.getEntity(UnionMobileTaskInfo.class, unionId, taskId);
        if (model != null) {
            return (UnionMobileTaskInfo) model;
        }
        return null;
    }

    // 获取玩家联盟总动员公共任务列表
    public static List<UnionMobileTaskInfo> getUnionMobileTaskList(long unionId) {
        List<UnionMobileTaskInfo> result = new ArrayList<>();
        List<Model> modelList = EntityManager.getEntityList(UnionMobileTaskInfo.class, unionId);
        if (modelList.isEmpty()) {
            return result;
        }
        for (Model model : modelList) {
            result.add((UnionMobileTaskInfo) model);
        }
        return result;
    }

    // 获取玩家联盟总动员具体的专属任务
    public static UserMobileTaskInfo getUserMobileTaskInfo(long userId, long taskId) {
        Model model = EntityManager.getEntity(UserMobileTaskInfo.class, userId, taskId);
        if (model != null) {
            return (UserMobileTaskInfo) model;
        }
        return null;
    }

    // 获取玩家联盟总动员专属任务列表
    public static List<UserMobileTaskInfo> getUserMobileTaskList(long userId) {
        List<UserMobileTaskInfo> result = new ArrayList<>();
        List<Model> modelList = EntityManager.getEntityList(UserMobileTaskInfo.class, userId);
        if (modelList.isEmpty()) {
            return result;
        }
        for (Model model : modelList) {
            result.add((UserMobileTaskInfo) model);
        }
        return result;
    }


    // 获取玩家联盟总动员信息
    public static UserMobileInfo getUserMobileInfo(long userId) {
        return (UserMobileInfo) EntityManager.getUniqueEntity(UserMobileInfo.class, userId);//
    }

    // 获取玩家联盟总动员联盟信息
    public static UnionMobileInfo getUnionMobileInfo(long unionId) {
        return (UnionMobileInfo) EntityManager.getUniqueEntity(UnionMobileInfo.class, unionId);//
    }
}
